import React, { Component } from 'react';

/* 
    1.属性代理
    a.1 操作props
*/
class App extends Component {
  render() {
    return (
      <div>
        <h1>App组件</h1>
        <h1>{this.props.msg}</h1>
        <button onClick={this.props.handleClick}>点击</button>
      </div>
    );
  }
}
/* 
  1.react-router   withRouter(App) =>添加路由的特性
  2.Connect(props,dispatch)(App)  redux 进
*/

function HigerOrderComponent(WrappedComponent){
  return class extends Component{
    handleClick =(params) => {
      console.log("高阶函数")
    }
    render(){
        let newProps ={
          msg:"🐂",
          handleClick:this.handleClick
        }
        return <WrappedComponent {...newProps}></WrappedComponent>
    }
  }
}
export default HigerOrderComponent(App);
